import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_base/generated/assets.dart';
// import 'package:shimmer/shimmer.dart';

import 'auto_image.dart';

class WidgetDefinePlaceholder extends StatelessWidget {
  const WidgetDefinePlaceholder(
      {super.key, this.width, this.height, this.backgroundColor, this.radius});

  final double? width;
  final double? height;
  final Color? backgroundColor;
  final double? radius;

  @override
  Widget build(BuildContext context) {
    return Container(
      width: width ?? double.infinity,
      height: height ?? double.infinity,
      decoration: BoxDecoration(
        color: backgroundColor,
        borderRadius: BorderRadius.circular(radius ?? 0),
      ),
      alignment: Alignment.center,
      child: AutoImage(Assets.basePlaceholder, width: 44.w),
    );
  }
}

class StaticPlaceholder extends StatelessWidget {
  const StaticPlaceholder({super.key, this.radius});

  final double? radius;

  @override
  Widget build(BuildContext context) {
    return Container(
      constraints: BoxConstraints(
        maxHeight: MediaQuery.of(context).size.height,
        maxWidth: MediaQuery.of(context).size.width,
      ),
      // decoration: BoxDecoration(
      // borderRadius: BorderRadius.circular(radius ??0)
      // ),

      // color: Colors.black.withOpacity(0.05),
      child: const FractionallySizedBox(
        alignment: Alignment.center,
        widthFactor: 0.3,
        child: AutoImage(Assets.basePlaceholder),
      ),
    );
  }
}

class DynamicPlaceholder extends StatelessWidget {
  const DynamicPlaceholder({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      constraints: BoxConstraints(
        maxHeight: MediaQuery.of(context).size.height,
        maxWidth: MediaQuery.of(context).size.width,
      ),
      color: Colors.black.withOpacity(0.05),
      child: const FractionallySizedBox(
        alignment: Alignment.center,
        widthFactor: 0.3,
        child: AutoImage(Assets.basePlaceholder),
      ),
    );
  }
}
